在瀏覽器與 node.js 運行 javascript


Posted by ericcch24 on 2020-06-22

瀏覽器

  • 用 git 建立一個 html 的檔案
  • vim 執行
  • 在 html 檔案中撰寫,並於兩個標籤間撰寫JavaScript程式碼。例如:
    <script>
    console.log("hello world")
    </script>
    
  • 存檔後用瀏覽器開啟此檔,F12 就看到上面程式碼的輸出結果

node.js

  • 用 git 建立一個 javascript 的檔案
  • 在裡面輸入
    console.log("hello world")
    
  • 在 git 輸入 node 檔名.js 即可輸出檔案的內容
    (或是直接在 git 輸入 node 也可以直接運行)

#WeeK2







Related Posts

[ js 筆記 ] 什麼是 hoisting?

[ js 筆記 ] 什麼是 hoisting?

[04] Renderless Component

[04] Renderless Component

Vue.js v-on 縮寫@

Vue.js v-on 縮寫@


Comments